//
//  App_VersionHandlers.swift
//  mall-ios
//
//  Created by Meak Tsui on 2018/11/26.
//  Copyright © 2018 Meak Tsui. All rights reserved.
//

import Foundation
import UIKit
import MTHybrid

extension Api {
    static let Version = Api("version")
}

class App_VersionHandler: MTEventHandler {
    var ns: Ns {
        return .App
    }
    
    var action: Api {
        return .Version
    }
    
    func handler(_ msg: MTHybridMsg) {
        let version = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as! String
        let build = Bundle.main.infoDictionary?["CFBundleVersion"] as! String
        msg.callbackClosure?(["version":version,"build":build])
    }
}
